--[[ 编码: WMS-15-10 名称: 收货单-主从面板-仓库变化后 作者:HAN 日期:2025-1-29 级别:项目 (说明本段代码在项目中需要变化) 函数:AfterWHChange 功能: - 根据新的仓库编号获取仓库下面的 收货区编码 更改记录: --]] wms_wh = require( "wms_wh" ) function AfterWHChange ( strLuaDEID ) local nRet, strRetInfo -- 获取仓库编码 nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_WH_CODE" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end local obj_attrs = json.decode( strRetInfo ) local wh_code = obj_attrs[1].value -- 仓库编码 -- 获取收货区 local area_items = '' local area_code = '' nRet, area_items = wms_wh.GetArea( strLuaDEID, wh_code, wms_base.Get_nConst(strLuaDEID, "库区类型-收货区") ) if ( nRet == 1 ) then area_code = lua.trim_quotation_mark( area_items ) end local setAttr = '[{"attr":"S_AREA_CODE","value":"'..area_code..'","choice_list":['..area_items..']}]' local strAction = '[{"action_type":"set_dlg_attr","value":'..setAttr..'}]' nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end